home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LTP_MoveToWindow.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  792b  |  37 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. VOID __regargs
  10. LTP_MoveToWindow(LayoutHandle *handle)
  11. {
  12.     if(V39 && handle -> MoveToWindow)
  13.     {
  14.         WORD left,top,width,height;
  15.  
  16.         LTP_GetDisplayClip(handle->Screen,&left,&top,&width,&height);
  17.  
  18.         if(handle -> Window -> Width < width)
  19.             left = (width - handle -> Window -> Width) / 2;
  20.         else
  21.             left = 0;
  22.  
  23.         if(handle -> Window -> Height < height)
  24.             top = (height - handle -> Window -> Height) / 2;
  25.         else
  26.             top = 0;
  27.  
  28.         if((left = handle -> Window -> LeftEdge - left) < 0)
  29.             left = 0;
  30.  
  31.         if((top = handle -> Window -> TopEdge - top) < 0)
  32.             top = 0;
  33.  
  34.         ScreenPosition(handle -> Screen,SPOS_MAKEVISIBLE,left,top,left + width - 1,top + height - 1);
  35.     }
  36. }
  37.